﻿$.using("kxtx.core.exception.service");

kxtx.core.exception.service.takeoverFunction = function (fn) {
    var newHandler = function () {
        try {
            fn.call(fn, arguments[0],
                                                        arguments[1],
                                                        arguments[2],
                                                        arguments[3],
                                                        arguments[4],
                                                        arguments[5],
                                                        arguments[6],
                                                        arguments[7],
                                                        arguments[8],
                                                        arguments[9],
                                                        arguments[10]);
        }
        catch (ex) {
            if (ex instanceof kxtx.core.exception) {
                kxtx.core.events.service.publish("kxtx.core.exception:occurred", ex);
            }
            else {
                alert("未知exception类型");
            }
        }
    };

    return newHandler;
}

